|
|
|
| Table 16.6. EquipSupplier and DeptSupplier tables. | | EquipSupplier | DeptSupplier | | EquipID | DeptID | | SupplierID | SupplierID |
|
|
|
|
|
|
These two tables are short because they are only needed to enforce expressed simple relationships between existing data tables. Creating small tables such as these is a handy way to reduce complex relationships to more straightforward ones. It is easier to create meaningful CONSTRAINT clauses when the tables are kept simple, too. The SQL DDL statements for these two tables appear in Listing 16.9. The result of executing these statements in Visdata appears in Figure 16.8. |
|
|
|
|
|
|
|
|
Figure 16.8.
EquipSupplier and DeptSupplier tables. |
|
|
|
|
|
|
|
|
Listing 16.9. Creating the EquipSupplier and DeptSupplier tables. |
|
|
|
|
|
|
|
|
CREATE TABLE EquipSupplier
(EquipID TEXT(10),
SupplierID TEXT(10),
CONSTRAINT PKEqSpl PRIMARY KEY (EquipID,SupplierID),
CONSTRAINT FKEqSplEquip FOREIGN KEY (EquipID)
REFERENCES Equipment(EquipID),
CONSTRAINT FKEqSplSupplier FOREIGN KEY (SupplierID) |
|
|
|
|
|